package com.roc.web.action.profit;

import java.util.ArrayList;
import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;
import com.roc.util.Constance;
import com.roc.util.DateTime;

public class YsbRingRewardProfitQuerySearchCondition extends BaseSearchCondition{

	private String beginTime;
	private long id;
	private long loginid;
	protected String getOrderPartOfHQL() {
		return null;
	}



	@Override
	protected String getRowCountHQL() {
		
		StringBuffer sb = new StringBuffer();

		sb.append(" select count(1) \n");
		sb.append(" from TBL_RING_REWARD_INFO t \n");
		sb.append("  where t.diffamt>0 \n");
		if(Constance.isNotEmpty(beginTime)){
			sb.append("  and t.mondate='").append(beginTime).append("' \n");
		}
		if(id==-1){
			sb.append("   and exists (SELECT 1 FROM t_operators where role_type in ('03', '02')  and id = t.agent_id  and supri_id = ").append(loginid).append(" )  \n ");

		}else{
			sb.append("    and t.agent_id = ").append(id).append(" \n");
		}
	     return sb.toString();

	}


	protected String getSearchHQL() {

		StringBuffer sb = new StringBuffer();
		sb.append(" select t.agentname, t.upamt, t.nowamt, t.diffamt, t.rewardamt, t.mondate \n");
		sb.append(" from TBL_RING_REWARD_INFO t \n");
		sb.append("  where  t.diffamt>0 \n");
		if(Constance.isNotEmpty(beginTime)){
			sb.append("  and t.mondate='").append(beginTime).append("' \n");
		}
		if(id==-1){
			sb.append("   and exists (SELECT 1 FROM t_operators where role_type in ('03', '02')  and id = t.agent_id  and supri_id = ").append(loginid).append(" )  \n ");

		}else{
			sb.append("    and t.agent_id = ").append(id).append(" \n");
		}
		return sb.toString();
	}
	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		List<WhereHQLFieldBean> filedBeanList = new ArrayList<WhereHQLFieldBean>();

		return filedBeanList;
	}


	public String getBeginTime() {
		return beginTime;
	}


	public void setBeginTime(String beginTime) {
		this.beginTime = beginTime;
	}



	public long getId() {
		return id;
	}


	public void setId(long id) {
		this.id = id;
	}



	public long getLoginid() {
		return loginid;
	}



	public void setLoginid(long loginid) {
		this.loginid = loginid;
	}






}
